<template>
  <div class="learn">
    <div class="center-content clearfix">
      <div class="learn-content">
        <header class="clearfix">
          <div class="user-info" v-if="userInfo.token">
            <div class="user-info-avater">
              <img :src="userInfo.user.headPortrait" alt="" />
            </div>
            <div class="user-info-content">
              <p class="className">您好，{{ userInfo.user.nickName }}！</p>
            </div>
          </div>
          <div class="user-info" v-else>
            <div class="user-info-avater">
              <img src="@/assets/img/student.jpg" alt="" />
            </div>
            <div class="user-info-content">
              <p class="className">同学您好，请先登录</p>
            </div>
          </div>
          <div class="user-nav">
            <div class="user-nav-item" @click="$router.push('/personalDetail')">
              <div class="nav-item-img item">
                <img src="../../assets/img/tongzhi.png" alt="" />
              </div>
              <p>我的资料</p>
            </div>
            <div class="user-nav-item" @click="$router.push('/personalCourse')">
              <div class="nav-item-img item">
                <img src="../../assets/img/zuoye.png" alt="" />
              </div>
              <p>我的课程</p>
            </div>
            <div class="user-nav-item" @click="$router.push('/personalExam')">
              <div class="nav-item-img item">
                <img src="../../assets/img/kaoshi.png" alt="" />
              </div>
              <p>我的考试</p>
            </div>
            <div class="user-nav-item" @click="$router.push('/personalQuestion')">
              <div class="nav-item-img item">
                <img src="../../assets/img/tongzhi.png" alt="" />
              </div>
              <p>我的问答</p>
            </div>
            <div class="user-nav-item" @click="$router.push('/personalHelpCenter')">
              <div class="nav-item-img item">
                <img src="../../assets/img/zuoye.png" alt="" />
              </div>
              <p>帮助中心</p>
            </div>
          </div>
        </header>
        <div class="class-content">
          <router-view></router-view>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { mapState } from "vuex";
export default {
  name: "home-center",
  data() {
    return {
    };
  },
  computed: {
    ...mapState({ userInfo: (state) => state.user }),
  },
  created() {
  },
  methods: {
  },
};
</script>

<style lang="scss" scoped>
.learn {
  width: 100%;
  background-color: #f7f7f7;
  overflow: hidden;
  padding-bottom: 80px;
  .center-content {
    height: 100%;
    min-height: 800px;
    padding-top: 20px;
  }
}
.learn-content {
  header {
    width: 100%;
    height: 182px;
    background: #fff;
    border-radius: 6px;
    overflow: hidden;
    font-size: 16px;
    .user-info {
      float: left;
      height: 88px;
      margin-top: 45px;
      margin-left: 23px;
      .user-info-avater {
        float: left;
        width: 88px px;
        height: 88px;
        img {
          width: 100%;
          height: 100%;
          border-radius: 88px;
        }
      }
      .user-info-content {
        margin-top: 15px;
        float: right;
        margin-left: 12px;
        p {
          margin: 15px 0;
        }
        .className {
          padding: 2px 9px;
          background: #eef3f7;
          max-width: 150px;
          overflow: hidden;
          text-overflow: ellipsis;
          white-space: nowrap;
        }
      }
    }
    .user-nav {
      float: right;
      margin-top: 40px;
      .user-nav-item {
        float: left;
        margin-right: 87px;
        text-align: center;
        cursor: pointer;
        .nav-item-img {
          position: relative;
          vertical-align: middle;
          display: inline-block;
          img {
            width: 58px;
            height: 58px;
          }
        }
        p {
          font-size: 20px;
          margin-top: 18px;
        }
      }
    }
  }
  .class-content {
    margin-top: 14px;
    background: #fff;
    min-height: 559px;
    border-radius: 6px;
    padding: 27px 33px;
    .class-head {
      border-bottom: 1px solid #eef3f7;
      padding-bottom: 13px;
      span {
        cursor: pointer;
        margin-right: 15px;
        vertical-align: middle;
        &:nth-child(2) {
          border-left: 1px solid #000;
          padding-left: 10px;
        }

        &.active {
          color: $theme-color-font;
          font-weight: 700;
          font-size: 18px !important;
        }
      }
    }


  }
}
</style>